package com.xxl.job.admin.api.controller;

import com.xxl.job.admin.api.service.ApiAppService;
import com.xxl.job.admin.api.vo.ApiParam;
import com.xxl.job.admin.controller.annotation.PermissionLimit;
import com.xxl.job.core.biz.model.ReturnT;
import io.micrometer.core.instrument.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * app
 */
@RestController
@RequestMapping("/app")
public class ApiController {
    @Autowired
    private ApiAppService apiAppService;

    @PermissionLimit(limit=false)
    @PostMapping("/appCall")
    public ReturnT<?> app(@RequestBody ApiParam param){

        if(StringUtils.isBlank(param.getOpeType())){
            return new ReturnT<>(500,"缺少参数");
        }

        return apiAppService.handler(param);
    }
}
